package com.winning.platwebservice.utils;

import com.winning.platwebservice.entity.SjyyxxEntity;
import com.winning.platwebservice.service.IDataService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class StartupRunner implements CommandLineRunner {

    private final static Logger logger = LogManager.getLogger();

    @Autowired
    private IDataService dataService;


    @Override
    public void run(String... args) throws Exception {
        logger.info(">>>>>>>>>>>>>>>加载ehcache<<<<<<<<<<<<<");
        List<SjyyxxEntity> listSjyxx = dataService.getSjyyxx();// 获取数据元表配置信息
        logger.info(">>>>>>>>>>>>>>>保存ehcache<<<<<<<<<<<<<");
        EhcacheUtil.zyCache.put("sjyxx", listSjyxx);


    }
}
